n=int(input())
capacities=list(map(int,input().split()))
minCap=int(input())

def getResult():
    if len(capacities)==1:
        return 1 if capacities[0]>=minCap else 0
    capacities.sort()
    left,right,teamCount=0,len(capacities)-1,0
    while left<right:
        if capacities[left]>=minCap:
            left+=1
            teamCount+=1
        if capacities[right]>=minCap:
            right-=1
            teamCount+=1
        if capacities[left]+capacities[right]>=minCap:
            left+=1
            right-=1
            teamCount+=1
        if capacities[left]+capacities[right]<minCap:
            left+=1
            right-=1
    return teamCount
print(getResult())